<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>练习2</title>
    <style>
        div{
            height: 80px;
            border: 1px solid black;
        }
    </style>
    <script>
        function show(){
            const color = document.getElementById("color").value;
            document.getElementById("one").style.backgroundColor = color;
        }
    </script>
</head>
<body>
    <div id="one"></div>
    <input id="color" placeholder="请输入颜色"/>
    <button onclick="show()">确认</button>
</body>
</html>